<template>
  <div class="latestnews-box" v-if="list.length">
    <div class="title">最新资讯</div>
    <div class="news-box">
      <NewsItem v-for="(item, index) of list" :key="index" :data="item" @click="onDetail(item)"/>
    </div>
  </div>
</template>

<script>
import NewsItem from '@/views/home/components/NewsItem';

export default {
  components: {
    NewsItem
  },
  props: {
    list: {
      type: Array,
      default() {
        return []
      }
    }
  },
  methods: {
    onDetail(item) {
      let routerJump = this.$router.resolve({ name: 'InformationDetail', query: {id: item.uuid} });
      window.open(routerJump.href, '_blank');
    }
  }
}
</script>

<style lang="scss" scoped>
.latestnews-box {
  padding-top: 52px;
  .title {
    height: 32px;
    font-size: 24px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #272727;
    line-height: 32px;
    margin-bottom: 24px;
  }
}
</style>